import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JCheckBox;


public class SetPasswordPanel extends JPanel {
	private final JTextField txtUsername;

	private final JTextField txtSystemAdminUsername;
	
	private final JTextField textField;
	private JTextField txtPassword;

	public SetPasswordPanel() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblResetUserPassword = new JLabel("Set User Password");
		springLayout.putConstraint(SpringLayout.WEST,
				lblResetUserPassword, 125, SpringLayout.WEST, this);
		lblResetUserPassword.setFont(new Font("Tahoma", 
				Font.BOLD | Font.ITALIC, 16));
		add(lblResetUserPassword);
		
		txtUsername = new JTextField();
		springLayout.putConstraint(SpringLayout.WEST, 
				txtUsername, 147, SpringLayout.WEST, this);
		txtUsername.setText("Username");
		add(txtUsername);
		txtUsername.setColumns(10);
		
		JLabel label_1 = new JLabel("System Adminstator Authorization:");
		springLayout.putConstraint(SpringLayout.NORTH,
				label_1, 26, SpringLayout.SOUTH, txtUsername);
		springLayout.putConstraint(SpringLayout.WEST, 
				label_1, 64, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, 
				label_1, -80, SpringLayout.EAST, this);
		label_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 16));
		add(label_1);
		
		txtSystemAdminUsername = new JTextField();
		springLayout.putConstraint(SpringLayout.EAST, 
				lblResetUserPassword, 0, SpringLayout.EAST, txtSystemAdminUsername);
		springLayout.putConstraint(SpringLayout.NORTH, 
				txtSystemAdminUsername, 32, SpringLayout.SOUTH, label_1);
		springLayout.putConstraint(SpringLayout.WEST, 
				txtSystemAdminUsername, 125, SpringLayout.WEST, this);
		txtSystemAdminUsername.setText("System Admin Username");
		add(txtSystemAdminUsername);
		txtSystemAdminUsername.setColumns(10);
		
		textField = new JTextField("System Admin Password");
		springLayout.putConstraint(SpringLayout.NORTH, 
				textField, 19, SpringLayout.SOUTH, txtSystemAdminUsername);
		springLayout.putConstraint(SpringLayout.EAST, 
				txtSystemAdminUsername, 0, SpringLayout.EAST, textField);
		springLayout.putConstraint(SpringLayout.WEST, 
				textField, 125, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, 
				textField, 285, SpringLayout.WEST, this);
		add(textField);
		textField.setColumns(10);
		
		JButton btnNewButton = new JButton("Lock User");
		springLayout.putConstraint(SpringLayout.NORTH, 
				btnNewButton, 51, SpringLayout.SOUTH, label_1);
		springLayout.putConstraint(SpringLayout.EAST, 
				btnNewButton, -30, SpringLayout.EAST, this);
		add(btnNewButton);
		
		JCheckBox chckbxIUnderstandThis = new JCheckBox("I understand this change.");
		springLayout.putConstraint(SpringLayout.WEST, 
				chckbxIUnderstandThis, 0, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, 
				chckbxIUnderstandThis, 0, SpringLayout.SOUTH, this);
		add(chckbxIUnderstandThis);
		
		JLabel lblEnterTheUsername = new JLabel("Enter the Username of the User " +
				"you want to set the password for,\r\n");
		springLayout.putConstraint(SpringLayout.SOUTH, 
				lblResetUserPassword, -6, SpringLayout.NORTH, lblEnterTheUsername);
		springLayout.putConstraint(SpringLayout.NORTH,
				lblEnterTheUsername, 36, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.NORTH, 
				txtUsername, 28, SpringLayout.SOUTH, lblEnterTheUsername);
		springLayout.putConstraint(SpringLayout.WEST, 
				lblEnterTheUsername, 64, SpringLayout.WEST, this);
		add(lblEnterTheUsername);
		
		txtPassword = new JTextField();
		txtPassword.setText("New Password");
		springLayout.putConstraint(SpringLayout.NORTH,
				txtPassword, 6, SpringLayout.SOUTH, txtUsername);
		springLayout.putConstraint(SpringLayout.EAST, 
				txtPassword, 0, SpringLayout.EAST, txtUsername);
		add(txtPassword);
		txtPassword.setColumns(10);
		
		JLabel lblAndTheirNew = new JLabel("and their new password.");
		springLayout.putConstraint(SpringLayout.NORTH, 
				lblAndTheirNew, 8, SpringLayout.SOUTH, lblEnterTheUsername);
		springLayout.putConstraint(SpringLayout.WEST, 
				lblAndTheirNew, 0, SpringLayout.WEST, label_1);
		add(lblAndTheirNew);
	}
}
